var apiRepair = "../index/";
var apiRecycle = "../index_recycle/";

/**
 * Created by lwei on 2017/4/9.
 */
function getQueryString(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
	var r = window.location.search.substr(1).match(reg);
	if (r != null) return unescape(r[2]); return null;
}

Date.prototype.Format = function(format) {
	var date = {
		"M+": this.getMonth() + 1,
		"d+": this.getDate(),
		"h+": this.getHours(),
		"m+": this.getMinutes(),
		"s+": this.getSeconds(),
		"q+": Math.floor((this.getMonth() + 3) / 3),
		"S+": this.getMilliseconds()
	};
	if (/(y+)/i.test(format)) {
		format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
	}
	for (var k in date) {
		if (new RegExp("(" + k + ")").test(format)) {
			format = format.replace(RegExp.$1, RegExp.$1.length == 1
				? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
		}
	}
	return format;
};

var recycleStatus = {
	"-1":"用户下单,后台未处理",
	"0":"用户下单,后台未处理",
	"1":"待接单",
	"2":"待回收",
	"3":"待确认",
	"4":"客户取消",
	"5":"待用户确认",
	"6":"已完成",
	"7":"已完成"
}

$.ajaxSetup({
	complete:function(d){
		if(d.responseJSON && d.responseJSON.code==0){
			$.get(apiRepair+"index.php?m=Home&c=Weixin&a=getAdminLoginRecycleUrl", {}, function(res){
				if(res.code==200){
					location.href=res.data;
				}
			}, "json");
		}
	}
});